<?php


namespace app\api\controller\uniapp;

use app\common\controller\Api;


/**
 * 小程序购物车接口
 * Class Index
 * @package app\api\controller\uniapp
 */
class GoodsCart extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];
    protected $service = null;

    public function _initialize()
    {
        parent::_initialize();
        $version = str_replace(".","",$this->version);
        $className = basename(__CLASS__);
        $serviceName = "app\\api\\service\\uniapp\\goodscart\\GoodsCart{$version}";
        $this->service = new $serviceName;
    }

    /**
     * 加入购物车
     * @return mixed
     */
    public function add_cart(){
        return $this->service->add_cart();
    }

    /**
     * 修改购物车
     */
    public function update_cart(){
        return $this->service->update_cart();
    }

    /**
     * 购物车生成订单
     */
    public function createorder(){
        return $this->service->createorder();
    }

    /**
     * 清空购物车
     */
    public function del_cart(){
        return $this->service->del_cart();
    }
}